package com.kun.oa.controller.rest;

import com.kun.oa.vo.RespStat;
import com.kun.oa.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * restful风格URI的controller
 * 只和用户交换JSON数据
 * @author Administrator
 *
 */
@RestController
@RequestMapping("/api/v1/manager/role")
public class RoleManagerRestController {
	
	@Autowired
	RoleService roleSrv;

	@RequestMapping("Permission/add")
	public RespStat permissionadd(@RequestParam int[] permissions, @RequestParam int id) {

		RespStat stat = new RespStat();

		boolean res = roleSrv.addPermission(id, permissions);

		if (res){
			stat.setCode(200);
			stat.setMsg("更新成功！！");
			return stat;
		} else {
			stat.setCode(001);
			stat.setMsg("更新失败！！");
			return stat;
		}

	}

}
